var fzChartData =[
    {position:[-140,40],text:'职业\n经理人',num:1628},
    {position:[-140,-50],text:'新型职业\n农民',num:1628},
    {position:[-60,-110],text:'家庭农场',num:387},
    {position:[60,-110],text:'社会组织',num:27},
    {position:[140,-50],text:'农业龙头\n企业',num:26},
    {position:[140,40],text:'合作社',num:556}
];
function init_fzChart(data) {
    var arr = [];
    function creatFzItem(obj) {
        return {
            type: 'group',
            position:obj.position,
            bounding: 'raw',
            children:[
                {
                    type: 'image',
                    right: 'center',
                    top: 'middle',
                    z: 10,
                    style: {
                        image: './img/index/cir_are_b.png',
                        width: 64,
                        height: 56,
                        opacity: 1
                    }
                },
                {
                    type: 'text',
                    right: 'center',
                    top: 'middle',
                    z: 100,
                    style: {
                        textAlign:'center',
                        fill: '#3274f1',
                        text: obj.text,
                        font: '10px Microsoft YaHei'
                    }
                },
                {
                    type: 'text',
                    right: 'center',
                    top: 16,
                    z: 100,
                    style: {
                        textAlign:'center',
                        fill: '#3274f1',
                        text: obj.num,
                        font: '10px Microsoft YaHei'
                    }
                } 

            ]
        }
    };
    data.forEach(function(i) {
        arr.push(creatFzItem(i))
    });
    function fzChart() {
        var fzoption = {
            graphic: [
            {
                type: 'group',
                left: 'center',
                top: 160,
                id:'fzgroup',
                scale:[1,1],
                origin:[0,20],
                bounding: 'raw',
                children:[
                    {
                        type: 'image',
                        id: 'icon',
                        right: 'center',
                        top: 'middle',
                        z: -10,
                        bounding: 'raw',
                        style: {
                            image: './img/index/dp.png',
                            width: 207,
                            height: 165,
                            opacity: 1
                        }
                    },
                    {
                        type: 'group',
                        right: 'center',
                        id:'fzData',
                        top: 'middle',
                        bounding: 'raw',
                        children:arr
                    },        
            ]},

            ],
            series: [

            ]
        };

        return fzoption;
    }

    function changeScaleFz() {
        var w = document.getElementById("fz").offsetWidth;
        var scale = [1,1];
        if (w < 360) {
            var j = w/360
            scale = [j,j];
        }
        fz.setOption({
            graphic: {
                id: 'fzgroup',
                scale: scale
            }
        });
    }
    var fz = echarts.init(document.getElementById("fz"));
    fz.setOption(fzChart(fzChartData));
    changeScaleFz();
    window.onresize = function () {//用于使chart自适应高度和宽度
        changeScaleFz();
        fz.resize();
    };    
}
init_fzChart(fzChartData);//调用位置